import { defineStore } from 'pinia'
import { ref } from 'vue'

// 用户模块
export const useUserStore = defineStore('room-ui-web-user', () => {
  // token
  const token = ref('')
  const setToken = (newTokent) => { token.value = newTokent }
  const removeToken = () => { token.value = '' }

  // user
  const user = ref({})
  const setUser = (newUser) => { user.value = newUser }
  const removeUser = () => { user.value = {} }

  return { token, setToken, removeToken, user, setUser, removeUser }
}, {
  persist: true
})